package com.yongchun.modelExt;

import com.yongchun.commons.NumberUtil;
import com.yongchun.commons.StringUtil;
import com.yongchun.commons.enums.ChargeRecordsStatusEnum;
import com.yongchun.commons.enums.WechatAppNameEnum;
import com.yongchun.model.ChargeRecords;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author afeng
 * @version 1.0
 * @date 2023/2/16 下午5:24
 */
@Data
public class ChargeRecordsExt extends ChargeRecords {

    private String playerName;

    private String playerUserId;

    private String statusDesc;

    private String payMoney;

    private String wxAppName;
    public String getWxAppName() {
        return WechatAppNameEnum.getWechatAppName(getWxAppId());
    }


    public String getPayMoney() {
        return String.format("%.2f", NumberUtil.divideBigDecimal(new BigDecimal(getTotalFee()), new BigDecimal(100)));
    }

    public String getStatusDesc() {
        if(StringUtil.isObjEmpty(getStatus())){
            return "新发起";
        }
        return ChargeRecordsStatusEnum.getChargeRecordsStatusDesc(getStatus());
    }
}
